<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDepartmentTable extends Migration
{
    /**
     * Run the migrations.
     * 部门表
     * @return void
     */
    public function up()
    {
        Schema::create('department', function (Blueprint $table) {
            $table->increments('id');
	        $table->string('code',50)->comment('部门编码');
	        $table->string('name',20)->comment('部门名称');
	        $table->tinyInteger('leader_id')->comment('部门负责人');
	        $table->tinyInteger('parent_id')->comment('上级部门');
	        $table->tinyInteger('status')->comment('配置状态：1有效，0无效')->default(1);
	        $table->integer('company_id')->comment('所属公司id')->nullable();
	        $table->integer('is_store')->comment('部门类型：1门店 2管理部门')->default(1);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('department');
    }
}
